package com.hsj.service.controller;

import dto.Reponse;
import dto.TransData;
import org.springframework.web.bind.annotation.*;
import pojo.User;

/**
 * @author:Teacher黄
 * @date:Created at 2020/01/01
 */
@RestController
public class HelloController {


    @GetMapping("/service01/hello")
    public String hello(){
        System.out.println("----------hello-----------");
        return "Hello SpringCloud!";
    }


    @GetMapping("/service01/get/{userName}")
    public TransData getData(@PathVariable String userName){
        User user = new User();
        user.setUserName(userName);
        return Reponse.ok("success",user);
    }

    @PostMapping("/service01/post")
    public TransData postData(@RequestBody String userName){
        User user = new User();
        user.setUserName(userName);
        return Reponse.ok("success",user);
    }

    @PostMapping("/service01/user")
    public TransData postUser(@RequestBody User user){
        return Reponse.ok("success",user);
    }


}
